<html>
<head><title>增加类别</title>
<script src="../assets/jquery.min.js"></script>
<meta charset="utf-8">
</head>

<body>
<form id="form">
输入商品类别：<input type="text" name="categoryName" id="categoryName"><br><br>
<input type="button" value="增加" id="add">
</form>
<script>
;!function(){
	$('#add').on('click', function(){
		  var formdata = categoryName.value;
		  //formdata = decodeURIComponent(formdata,true);
		  $.ajax({
		            url: 'category/addCategory',    //提交地址
		            type: 'post',   //提交方式
		            dataType:'json',
		            data: {"name":formdata},
		            success: function(data) {   //成功返回信息
		                window.alert(data.msg);
		            }
		        });
		});

		}();
</script>
</body>
</html>